select @@servername
select @@version


select   loginname,name,dbname,sysadmin   from   master..syslogins
order by dbname

select a.srvid,a.srvname,a.datasource,b.name from 
(select srvid,srvname,datasource
from master..sysservers
where isremote = 1) as a
inner join (
select srvid,name from master..sysxlogins
where srvid is not null) as b
on a.srvid = b.srvid




select * from master.sys.linked_logins










select 
name, cmptlevel,DATABASEPROPERTYEX(name,'RECOVERY'),filename
from master..sysdatabases
where name not in('master','model','tempdb','msdb')

SELECT * FROM MASTER..SYSFILES
SELECT * FROM LENHR..SYSFILES

DECLARE @DBName NVARCHAR(256),@query NVARCHAR(4000),@RecordTime DATETIME,@DBUsageId INT
CREATE TABLE #FileTable(DBNAME NVARCHAR(256),fileid SMALLINT,size INT,name NVARCHAR(256),filename NVARCHAR(256),Usage INT,Islog BIT,Dir CHAR(1))
DECLARE DBCU CURSOR
FOR
  select 
  name
  from master..sysdatabases
  where name not in('master','model','tempdb','msdb')
OPEN DBCU
FETCH NEXT FROM DBCU INTO @DBName
WHILE @@FETCH_STATUS = 0
BEGIN
    SET @query = REPLACE('
    USE [#DBName#]
    SELECT ''#DBName#'',
    fileid,size,name,filename,
    FILEPROPERTY(name, ''SpaceUsed'') AS Usage,
    FILEPROPERTY(name, ''IsLogFile'') AS Islog,
    SUBSTRING(filename,1,CHARINDEX(''\'',filename)-2) AS Dir
    FROM [#DBName#].dbo.sysfiles','#DBName#',@DBName)
    INSERT INTO #FileTable
    EXEC SP_EXECUTESQL @query
  FETCH NEXT FROM DBCU INTO @DBName
END
CLOSE DBCU
DEALLOCATE DBCU
SELECT * FROM #FileTable
DROP TABLE  #FileTable

SELECT * FROM MSDB..SYSJOBS
WHERE ENABLED = 1